var utils = require('../utils/wechatutil');
var settings = require('../config');
var wc = require('wechat');
var debug = require('debug')('consultant:test');
// new utils().getAPI(function(api) {
// 	//葛雷oqaCmjpGrC29kvyxMZfsb14A68mg
// 	//张小超oqaCmjjQ26Zlcgmk_BnhJwoELXSg
// 	// api.sendText("oqaCmjjQ26Zlcgmk_BnhJwoELXSg", "<a href='http://www.baidu.com'>百度</a>", function(err, result) {
// 	// 	console.log(err);
// 	// 	console.log(result);
// 	// });
// 	api.sendVideo("oqaCmjjQ26Zlcgmk_BnhJwoELXSg", "Xur5-aEYDKMpvjJKM9QXf9ne5oaqSlXyr3-hWey9qZ-3Enu66zWgI_Co-UjSG0A1", "t2p7jOJLGl8C-FLknbCIFRX3LvZA2UA8Dph7kbMca_V7xSm-GSOLRoWL7UJ-BZRJ", function(err, result) {
// 		if (err) debug("send fail!", err);
// 	})
// 	return;
// })

var api = new wc.API(settings.wc_appid, settings.wc_appsecret);
api.getAccessToken(function(err, result) {
	debug("this token is:", result);
	if (err) {
		debug("getAccessToken fail", err);
		return err;
	}
	if (result) {
		// return api
		api.sendVideo("oqaCmjpQlgCvRTPzsv-08UTHh33A", "Xur5-aEYDKMpvjJKM9QXf9ne5oaqSlXyr3-hWey9qZ-3Enu66zWgI_Co-UjSG0A1", "t2p7jOJLGl8C-FLknbCIFRX3LvZA2UA8Dph7kbMca_V7xSm-GSOLRoWL7UJ-BZRJ", function(err, result) {
			if (err) debug("send fail!", result);
		})
	}
});